﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System
{
    public static class RandomExtensions
    {
        public static string String(this Random rand, int length)
        {
            StringBuilder builder = new StringBuilder();
            int i = 0;
            while (i++ < length) {
                char c = (char)rand.Next((int)'A', (int)'z' + 1);
                if (char.IsLetter(c) == false) {
                    i--;
                } else {
                    builder.Append(c);
                }
            }
            return builder.ToString();
        }

        public static string NumberString(this Random rand, int length)
        {
            StringBuilder builder = new StringBuilder();
            for (int i = 0; i < length; i++) {
                builder.Append(rand.Next(0, 10).ToString());
            }
            return builder.ToString();
        }
    }
}
